#define _CRT_SECURE_NO_WARNINGS 1

#include<iostream>
#include<vector>

using namespace std;

int getgoal(vector<int>& p)
{
    int t = 0;
    int res = 0;
    for (int i = 0; i < p.size(); i++)
    {
        res += p[i];
        if (t > 0)   res += p[i];
        t--;
        if (p[i] == 10)  t = 2;
    }
    return res;
}

int isWinner(vector<int>& player1, vector<int>& player2) {
    int a = getgoal(player1);
    int b = getgoal(player2);

    if (a == b)  return 0;
    else if (a > b)  return 1;
    else    return 2;
}